
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="struts"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>添加新的书籍</title>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<style type="text/css">
			<!--
			body {
				background-color: #aed4ff;
			}
			-->
		</style>
	
		<script>
		
			function isNull(str) {
				if (str == "")
					return true;
				var regu = "^[ ]+$";
				var re = new RegExp(regu);
				return re.test(str);
			}

			function isNumber(s) {
				var regu = "^[0-9]+$";
				var re = new RegExp(regu);
				if (s.search(re) != -1) {
					return true;
				} else {
					return false;
				}
			}

			function verify() {
				if (isNull(document.getElementById("name_js").value)) {
					alert("书籍名称不能为空");
					return false;
				} else if (isNull(document.getElementById("price_js").value)) {
					alert("书籍价格不能为空！");
					return false;
				} else if (!isNumber(document.getElementById("price_js").value)) {
					alert("书籍价格必须为正整数！");
					return false;
				} else
					return true;

			}
		</script>
	</head>
	
	<body>
		<img src="/bookshop-online/image/bupt_manage.jpg" width="229" height="259" hspace="200" vspace="150">	
	
		<div style="position:absolute;top=150;left=500;">
			<struts:form action="newBookAction"
				method="POST"
				enctype="multipart/form-data">
				<struts:textfield name="name" label="书籍名称" id="name_js"/><br />
				<struts:textfield name="price" label="书籍价格" id="price_js"/><br />
				<struts:file name="upload" label="选择文件"/><br />
				<struts:submit value="上传" onclick="return verify();"/>
			</struts:form>
			<a href="/bookshop-online/admin/admin_main.jsp">返回管理界面</a>
		</div>

	</body>
</html>